package com.tuanbiao.ui.setting;

import android.content.Context;
import android.content.Intent;

import com.hzjq.data.hzjq.entity.DeviceInfoEntity;
import com.tuanbiao.base.mvp.BasePresenterActivity;
import com.tuanbiao.controllers.SettingController;
import com.tuanbiao.databinding.ActivityDeviceInfoBinding;
import com.tuanbiao.models.SettingModel;
import com.tuanbiao.presenter.setting.SettingDeviceInfoPresenter;

public class DeviceInfoActivity extends BasePresenterActivity<SettingDeviceInfoPresenter, ActivityDeviceInfoBinding> implements SettingController.DeviceInfoView {

    public static void start(Context context) {
        Intent starter = new Intent(context, DeviceInfoActivity.class);
        context.startActivity(starter);
    }

    @Override
    protected ActivityDeviceInfoBinding getBindingView() {
        return ActivityDeviceInfoBinding.inflate(getLayoutInflater());
    }

    @Override
    protected void initView() {
        binding.ivToolbarBack.setOnClickListener(getBackListener());
    }


    @Override
    protected SettingDeviceInfoPresenter createPresenter() {
        return new SettingDeviceInfoPresenter(new SettingModel(), this);
    }

    @Override
    public void showDeviceInfo(DeviceInfoEntity entity) {
        binding.sbActiveTime.setRightText(entity.getTime());
        binding.sbDeviceNum.setRightText(entity.getNum());
        binding.sbDeviceType.setRightText(entity.getDevicetype());
        binding.sbMac.setRightText(entity.getMac());
        binding.sbImei.setRightText(entity.getIem());
        binding.tvUseUnit.setText(entity.getBuydeptid());
        binding.tvCreateUnit.setText(entity.getDeptid());
    }
}